﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="HourRep.aspx.cs" Inherits="Cs_HourRep" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>
        <%= pName%>报表</title>
    <link href="../css/SIS.css" rel="stylesheet" type="text/css" />

    <script language="javascript" type="text/javascript" src="../My97DatePicker/WdatePicker.js"></script>

    <script language="javascript" type="text/javascript" src="../Js/Excel.js"></script>

    <script src="../Js/jquery-1.6.2.js" type="text/javascript"></script>

    <script src="../WPS/Letter.js" type="text/javascript"></script>

    <script src="../WPS/Hour.js" type="text/javascript"></script>

    <script type="text/javascript" language="javascript">

        var count=0; 
        var num =0;
        var title='';
        $(document).ready(function(){
            var myDate = new Date();            
//                     
//            $("#txtDate").val(myDate.toLocaleDateString().replace('年','-').replace('月','-').replace('日',''));
            getDate();
            $("#btnSearch").click(function() {

                $("#dvInfo").hide();  
                $("#divWait").show();
                $("#dvShow").hide();
                
                $.post("HourRep.aspx", { param: 'query', time: $("#txtDate").val(),unit:$("#jz").val()}, function (data) {                  
                   count= data.count; 
                   num = data.num;     
                   title = data.title;      
                   $("#dvShow").html(data.tableInfo);
                   $("#dvShow").show();
                   $("#divWait").hide();
                
                }, 'json');
            });    
            
            $("#divWait").show();
            
            load();
                       
            $("#btnWPS").click(function() {       
                AutomateWPS(CX,count,num,title);
            });              
            
            $("#btnExcel").click(function() {           
                toExcel(CX);
            });  
        });
                
        function getDate(){
            var myDate = new Date();
            var date;
            
            if(myDate.getMonth()==0 && myDate.getDate()==1){
                date = myDate.getYear()+'-'+Number(myDate.getMonth()+1)+'-'+Number(myDate.getDate()-1);     
            }else if(Number(myDate.getDate())==1){
                var month= myDate.getMonth();
                if(month==1||month==3||month==5||month==7||month==8||month==10){               
                    date = myDate.getYear()+'-'+myDate.getMonth()+'-31';   
                }else if(month==4||month==6||month==9||month==11){
                    date = myDate.getYear()+'-'+myDate.getMonth()+'-30';  
                }else{
                    if(myDate.getYear%4==0){
                        date = myDate.getYear()+'-'+myDate.getMonth()+'-29';  
                    }else{
                        date = myDate.getYear()+'-'+myDate.getMonth()+'-28';  
                    }
                }
            }else{
                date = myDate.getYear()+'-'+Number(myDate.getMonth()+1)+'-'+Number(myDate.getDate()-1);     
            }  
            $("#txtDate").val(date);
        }
        
        
        function load(){
            $.post("HourRep.aspx", { param: '', time: $("#txtDate").val(),unit:$("#jz").val()}, function (data) {
                count= data.count;
                num = data.num;
                title = data.title;
                $("#dvShow").html(data.tableInfo);
                $("#divWait").hide();
            }, 'json');
        }
        
        function printsection()   
        {   
            var   aaa   =   document.all.dvShow.innerHTML;   
            var   ddd   =   document.body.innerHTML;   
            document.body.innerHTML   =   aaa;   
            window.print();   
            document.body.innerHTML   =   ddd;   
            return   false;   
        } 
        
       
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div id="Div1">
        <img id="imgTop" height="38px;" src="../img/<%= pName%>.jpg" width="100%" />
    </div>
    <table style="width: 90%;">
        <tr>
            <td align="left" valign="middle">
                &nbsp; &nbsp; 选择机组:&nbsp;
                <select id="jz" runat="server">
                    <option id="Option0" value="1">#1机组</option>
                    <option id="Option1" value="2">#2机组</option>
                </select>
                &nbsp; &nbsp
                <label id="lalStime" style="height: 30px;" runat="server" class="td_title">
                    查询日期:</label>
                &nbsp; &nbsp; &nbsp;
                <input type="text" id="txtDate" style="text-align: center;" runat="server" readonly="readonly"
                    onfocus="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd'})" class="Wdate" />
                &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                <input id="btnSearch" type="button" value=" 查 询" style="height: 22px" class="nvinput" />
                &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                <input id="btnExcel" type="button" style="height: 22px" value="导出Excel" class="nvinput" />
                &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                <input id="btnWPS" type="button" style="height: 22px" value="导出WPS" class="nvinput" />
            </td>
        </tr>
    </table>
    <%--    <div id="div2">
        <img id="Img1" src="../img/loading.gif" />
    </div>--%>
    <div id="divWait">
        <img id="loadImg" src="../img/loading.gif" />
    </div>
    <div id="dvShow">
    </div>
    <div id="dvInfo" runat="server">
    </div>
    </form>
</body>
</html>
